package generic10;

class Point1<K,V>
{
	private K x;
	private V y;
	public Point1()
	{
		
	}
	public Point1(K x,V y)
	{
		this.setX(x);
		this.setY(y);
	}
	public void setX(K x)
	{
		this.x = x;
	}
	public void setY(V y)
	{
		this.y = y;
	}
	public K getX()
	{
		return this.x;
	}
	public V getY()
	{
		return this.y;
	}
	public String toString()
	{
		return "X的坐标是："+this.getX()+",y的坐标是："+this.getY();
	}
	
}
public class GenericDemo02
{

	/**
	 * @param args
	 */
	@SuppressWarnings("unchecked")
	public static void main(String[] args)
	{
		Class<?> c1 = null;
		Point1<String,Integer> point = null;
		try
		{
			c1 = Class.forName("generic10.Point1");
		}
		catch(ClassNotFoundException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        try
		{
        	point = (Point1<String, Integer>)c1.newInstance();
		}
		catch(InstantiationException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch(IllegalAccessException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		point.setX("kkkk");
		point.setY(4);
		System.out.print(point.toString());
		
	}

}
